


/*
'===============================================================================
'  HNG.Portal.BL.TblBannerManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Windows.Forms;
namespace HNG.Portal.BLL
{
	public class TblBannerManagerBase
	{
	    
		#region ColumnNames
		
				public const String Field_Id="Id";
				
				public const String Field_LangId="LangId";
				
				public const String Field_TenBanner="TenBanner";
				
				public const String Field_MoTa="MoTa";
				
				public const String Field_ViTri="ViTri";
				
				public const String Field_Dai="Dai";
				
				public const String Field_Rong="Rong";
				
				public const String Field_Url="Url";
				
				public const String Field_Image="Image";
				
				public const String Field_NgayTao="NgayTao";
				
				public const String Field_NgayBatDau="NgayBatDau";
				
				public const String Field_NgayKetThuc="NgayKetThuc";
				
				public const String Field_ThuTu="ThuTu";
				
				public const String Field_TrangThai="TrangThai";
				
				public const String Field_Type="Type";
				
		#endregion	
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		public TblBannerManagerBase()
		{
			// Nothing for now.
		}
		public DataTable Clone()
		{
			DataTable dt = new DataTable();
						
			
			dt.Columns.Add(Field_Id,typeof(int));
			
						
			
			dt.Columns.Add(Field_LangId,typeof(string));
			
						
			
			dt.Columns.Add(Field_TenBanner,typeof(string));
			
						
			
			dt.Columns.Add(Field_MoTa,typeof(string));
			
						
			
			dt.Columns.Add(Field_ViTri,typeof(string));
			
						
			
			dt.Columns.Add(Field_Dai,typeof(int));
			
						
			
			dt.Columns.Add(Field_Rong,typeof(int));
			
						
			
			dt.Columns.Add(Field_Url,typeof(string));
			
						
			
			dt.Columns.Add(Field_Image,typeof(string));
			
						
			
			dt.Columns.Add(Field_NgayTao,typeof(DateTime));
			
						
			
			dt.Columns.Add(Field_NgayBatDau,typeof(DateTime));
			
						
			
			dt.Columns.Add(Field_NgayKetThuc,typeof(DateTime));
			
						
			
			dt.Columns.Add(Field_ThuTu,typeof(int));
			
						
			
			dt.Columns.Add(Field_TrangThai,typeof(bool));
			
						
			
			dt.Columns.Add(Field_Type,typeof(string));
			
			            
            return dt;			
		}
			
		public TblBannerEntity Convert_Entity(TblBannerEntity _TblBannerEntity,TblBannerEntity _TblBannerEntity_XML)
		{	
			
				
			_TblBannerEntity.Id= _TblBannerEntity_XML.Id;
				
			_TblBannerEntity.LangId= _TblBannerEntity_XML.LangId;
				
			_TblBannerEntity.TenBanner= _TblBannerEntity_XML.TenBanner;
				
			_TblBannerEntity.MoTa= _TblBannerEntity_XML.MoTa;
				
			_TblBannerEntity.ViTri= _TblBannerEntity_XML.ViTri;
				
			_TblBannerEntity.Dai= _TblBannerEntity_XML.Dai;
				
			_TblBannerEntity.Rong= _TblBannerEntity_XML.Rong;
				
			_TblBannerEntity.Url= _TblBannerEntity_XML.Url;
				
			_TblBannerEntity.Image= _TblBannerEntity_XML.Image;
				
			_TblBannerEntity.NgayTao= _TblBannerEntity_XML.NgayTao;
				
			_TblBannerEntity.NgayBatDau= _TblBannerEntity_XML.NgayBatDau;
				
			_TblBannerEntity.NgayKetThuc= _TblBannerEntity_XML.NgayKetThuc;
				
			_TblBannerEntity.ThuTu= _TblBannerEntity_XML.ThuTu;
				
			_TblBannerEntity.TrangThai= _TblBannerEntity_XML.TrangThai;
				
			_TblBannerEntity.Type= _TblBannerEntity_XML.Type;
				
			
			return _TblBannerEntity;
		}	
		
			
		public void InsertCollection(EntityCollection _Collection)
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                adapter.SaveEntityCollection(_Collection);
            }
		}

		public TblBannerEntity Insert(TblBannerEntity TblBannerEntity)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(TblBannerEntity, true);
			}
			return TblBannerEntity;
		}

		
		public TblBannerEntity Insert(int Id, string LangId, string TenBanner, string MoTa, string ViTri, int Dai, int Rong, string Url, string Image, DateTime NgayTao, DateTime NgayBatDau, DateTime NgayKetThuc, int ThuTu, bool TrangThai, string Type)
		{
			TblBannerEntity _TblBannerEntity = new TblBannerEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblBannerEntity.Id = Id;
				_TblBannerEntity.LangId = LangId;
				_TblBannerEntity.TenBanner = TenBanner;
				_TblBannerEntity.MoTa = MoTa;
				_TblBannerEntity.ViTri = ViTri;
				_TblBannerEntity.Dai = Dai;
				_TblBannerEntity.Rong = Rong;
				_TblBannerEntity.Url = Url;
				_TblBannerEntity.Image = Image;
				_TblBannerEntity.NgayTao = NgayTao;
				_TblBannerEntity.NgayBatDau = NgayBatDau;
				_TblBannerEntity.NgayKetThuc = NgayKetThuc;
				_TblBannerEntity.ThuTu = ThuTu;
				_TblBannerEntity.TrangThai = TrangThai;
				_TblBannerEntity.Type = Type;
				adapter.SaveEntity(_TblBannerEntity, true);
			}
			return _TblBannerEntity;
		}

		public TblBannerEntity Insert(string LangId, string TenBanner, string MoTa, string ViTri, int Dai, int Rong, string Url, string Image, DateTime NgayTao, DateTime NgayBatDau, DateTime NgayKetThuc, int ThuTu, bool TrangThai, string Type)
		{
			TblBannerEntity _TblBannerEntity = new TblBannerEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblBannerEntity.LangId = LangId;
				_TblBannerEntity.TenBanner = TenBanner;
				_TblBannerEntity.MoTa = MoTa;
				_TblBannerEntity.ViTri = ViTri;
				_TblBannerEntity.Dai = Dai;
				_TblBannerEntity.Rong = Rong;
				_TblBannerEntity.Url = Url;
				_TblBannerEntity.Image = Image;
				_TblBannerEntity.NgayTao = NgayTao;
				_TblBannerEntity.NgayBatDau = NgayBatDau;
				_TblBannerEntity.NgayKetThuc = NgayKetThuc;
				_TblBannerEntity.ThuTu = ThuTu;
				_TblBannerEntity.TrangThai = TrangThai;
				_TblBannerEntity.Type = Type;
				adapter.SaveEntity(_TblBannerEntity, true);
			}
			return _TblBannerEntity;
		}

		public bool Update(TblBannerEntity _TblBannerEntity)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(TblBannerFields.Id == _TblBannerEntity.Id);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_TblBannerEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}
		
		public bool Update(TblBannerEntity _TblBannerEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_TblBannerEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}

		public bool Update(int Id, string LangId, string TenBanner, string MoTa, string ViTri, int Dai, int Rong, string Url, string Image, DateTime NgayTao, DateTime NgayBatDau, DateTime NgayKetThuc, int ThuTu, bool TrangThai, string Type)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblBannerEntity _TblBannerEntity = new TblBannerEntity(Id);
				if (adapter.FetchEntity(_TblBannerEntity))
				{
				
					_TblBannerEntity.LangId = LangId;
					_TblBannerEntity.TenBanner = TenBanner;
					_TblBannerEntity.MoTa = MoTa;
					_TblBannerEntity.ViTri = ViTri;
					_TblBannerEntity.Dai = Dai;
					_TblBannerEntity.Rong = Rong;
					_TblBannerEntity.Url = Url;
					_TblBannerEntity.Image = Image;
					_TblBannerEntity.NgayTao = NgayTao;
					_TblBannerEntity.NgayBatDau = NgayBatDau;
					_TblBannerEntity.NgayKetThuc = NgayKetThuc;
					_TblBannerEntity.ThuTu = ThuTu;
					_TblBannerEntity.TrangThai = TrangThai;
					_TblBannerEntity.Type = Type;
					adapter.SaveEntity(_TblBannerEntity, true);
					toReturn = true;
				}
			}
			return toReturn;
		}

		public bool Delete(int Id)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblBannerEntity _TblBannerEntity = new TblBannerEntity(Id);
				if (adapter.FetchEntity(_TblBannerEntity))
				{
					adapter.DeleteEntity(_TblBannerEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("TblBannerEntity", null);
			}
		}
		
		
		public int DeleteById(int Id)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByLangId(string LangId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTenBanner(string TenBanner)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.TenBanner == TenBanner);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByMoTa(string MoTa)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.MoTa == MoTa);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByViTri(string ViTri)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.ViTri == ViTri);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByDai(int Dai)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Dai == Dai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByRong(int Rong)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Rong == Rong);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByUrl(string Url)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Url == Url);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByImage(string Image)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByNgayTao(DateTime NgayTao)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayTao == NgayTao);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByNgayBatDau(DateTime NgayBatDau)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayBatDau == NgayBatDau);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByNgayKetThuc(DateTime NgayKetThuc)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayKetThuc == NgayKetThuc);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByThuTu(int ThuTu)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.ThuTu == ThuTu);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTrangThai(bool TrangThai)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByType(string Type)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Type == Type);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblBannerEntity", filter);
			}
			return toReturn;
		}
		

		
		public TblBannerEntity SelectOne(int Id)
		{
			TblBannerEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblBannerEntity _TblBannerEntity = new TblBannerEntity(Id);
				if (adapter.FetchEntity(_TblBannerEntity))
				{
					toReturn = _TblBannerEntity;
				}
			}
			return toReturn;
		}

		// Return EntityCollection
		public EntityCollection SelectAll()
		{
			EntityCollection _TblBannerCollection = new EntityCollection( new TblBannerEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, null, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}

		
		// Return EntityCollection
		public EntityCollection SelectById(int Id)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT(int Id)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByLangId(string LangId)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByLangIdRDT(string LangId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTenBanner(string TenBanner)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.TenBanner == TenBanner);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTenBannerRDT(string TenBanner)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.TenBanner == TenBanner);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByMoTa(string MoTa)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.MoTa == MoTa);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByMoTaRDT(string MoTa)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.MoTa == MoTa);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByViTri(string ViTri)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.ViTri == ViTri);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByViTriRDT(string ViTri)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.ViTri == ViTri);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByDai(int Dai)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Dai == Dai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByDaiRDT(int Dai)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Dai == Dai);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByRong(int Rong)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Rong == Rong);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByRongRDT(int Rong)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Rong == Rong);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByUrl(string Url)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Url == Url);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByUrlRDT(string Url)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Url == Url);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByImage(string Image)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByImageRDT(string Image)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByNgayTao(DateTime NgayTao)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayTao == NgayTao);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByNgayTaoRDT(DateTime NgayTao)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayTao == NgayTao);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByNgayBatDau(DateTime NgayBatDau)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayBatDau == NgayBatDau);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByNgayBatDauRDT(DateTime NgayBatDau)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayBatDau == NgayBatDau);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByNgayKetThuc(DateTime NgayKetThuc)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayKetThuc == NgayKetThuc);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByNgayKetThucRDT(DateTime NgayKetThuc)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.NgayKetThuc == NgayKetThuc);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByThuTu(int ThuTu)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.ThuTu == ThuTu);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByThuTuRDT(int ThuTu)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.ThuTu == ThuTu);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTrangThai(bool TrangThai)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTrangThaiRDT(bool TrangThai)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByType(string Type)
		{
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Type == Type);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblBannerCollection, filter, 0, null);
			}
			return _TblBannerCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTypeRDT(string Type)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblBannerCollection = new EntityCollection(new TblBannerEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblBannerFields.Type == Type);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblBannerCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		

	}
}
